"use strict";
cc._RF.push(module, '56592kk8cJFYI89WRVPCFaT', 'button');
// Script/button.ts

"use strict";
// Learn TypeScript:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var button = /** @class */ (function (_super) {
    __extends(button, _super);
    function button() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    button.prototype.onLoad = function () {
        this.node.on(cc.Node.EventType.TOUCH_START, this.touchStart, this);
        this.node.on(cc.Node.EventType.TOUCH_END, this.touchEnd, this);
        this.node.on(cc.Node.EventType.TOUCH_CANCEL, this.touchCancel, this);
    };
    button.prototype.show = function () {
        var _this = this;
        this.node.stopAllActions();
        this.node.scale = 0;
        this.node.angle = 0;
        cc.tween(this.node)
            .parallel(cc.tween()
            .to(7 / 30, { scaleX: 1.15, scaleY: 1 })
            .to(4 / 30, { scale: 1 }), cc.tween()
            .to(1 / 30, { angle: -5 }, { easing: 'sineIn' })
            .to(3 / 30, { angle: 0 }, { easing: 'sineIn' })
            .to(1 / 30, { angle: 5 }, { easing: 'sineIn' })
            .to(1 / 30, { angle: 0 }, { easing: 'sineIn' })
            .to(1 / 30, { angle: -5 }, { easing: 'sineIn' })
            .to(1 / 30, { angle: 0 }, { easing: 'sineIn' })
            .to(2 / 30, { angle: -1 }, { easing: 'sineIn' })
            .to(2 / 30, { angle: 0 }, { easing: 'sineIn' }))
            .call(function () {
            cc.tween(_this.node)
                .to(20 / 30, { scaleX: 1.04, scaleY: 0.94 }, { easing: 'sineIn' })
                .to(20 / 30, { scaleX: 1, scaleY: 1 }, { easing: 'sineIn' })
                .union()
                .repeatForever()
                .start();
        })
            .start();
    };
    button.prototype.touchStart = function () {
        var _this = this;
        this.node.stopAllActions();
        cc.tween(this.node)
            .parallel(cc.tween()
            .to(1 / 30, { opacity: 255 * 0.5 }), cc.tween()
            .to(3 / 30, { scale: 0.8 })
            .to(3 / 30, { scale: 0.9 })
            .to(3 / 30, { scale: 0.82 })
            .to(3 / 30, { scale: 0.88 })
            .to(3 / 30, { scale: 0.84 })
            .to(3 / 30, { scale: 0.86 })
            .to(3 / 30, { scale: 0.85 }))
            .call(function () {
            cc.tween(_this.node)
                .to(15 / 30, { scaleX: 0.88 }, { easing: 'sineInOut' })
                .to(15 / 30, { scaleX: 0.82 }, { easing: 'sineInOut' })
                .to(15 / 30, { scaleX: 0.88 }, { easing: 'sineInOut' })
                .to(15 / 30, { scaleX: 0.82 }, { easing: 'sineInOut' })
                .union()
                .repeatForever()
                .start();
        })
            .start();
    };
    button.prototype.touchEnd = function () {
        var _this = this;
        this.node.stopAllActions();
        cc.tween(this.node)
            .parallel(cc.tween()
            .to(1 / 30, { opacity: 255 }), cc.tween()
            .to(3 / 30, { scale: 1.2 })
            .to(3 / 30, { scale: 0.9 })
            .to(3 / 30, { scale: 1.15 })
            .to(3 / 30, { scale: 0.95 })
            .to(3 / 30, { scale: 1.1 })
            .to(3 / 30, { scale: 1 }))
            .call(function () {
            cc.tween(_this.node)
                .to(20 / 30, { scaleX: 1.04, scaleY: 0.94 }, { easing: 'sineIn' })
                .to(20 / 30, { scaleX: 1, scaleY: 1 }, { easing: 'sineIn' })
                .union()
                .repeatForever()
                .start();
        })
            .start();
    };
    button.prototype.touchCancel = function () {
        var _this = this;
        this.node.stopAllActions();
        cc.tween(this.node)
            .parallel(cc.tween()
            .to(1 / 30, { opacity: 255 }), cc.tween()
            .to(3 / 30, { scale: 1.2 })
            .to(3 / 30, { scale: 0.9 })
            .to(3 / 30, { scale: 1.15 })
            .to(3 / 30, { scale: 0.95 })
            .to(3 / 30, { scale: 1.1 })
            .to(3 / 30, { scale: 1 }))
            .call(function () {
            cc.tween(_this.node)
                .to(20 / 30, { scaleX: 1.04, scaleY: 0.94 }, { easing: 'sineIn' })
                .to(20 / 30, { scaleX: 1, scaleY: 1 }, { easing: 'sineIn' })
                .union()
                .repeatForever()
                .start();
        })
            .start();
    };
    button = __decorate([
        ccclass
    ], button);
    return button;
}(cc.Component));
exports.default = button;

cc._RF.pop();